/**
 * 
 */
package net.phoenix.nlp.pos;

import net.phoenix.nlp.pos.dictionary.BasicTermNatures;

/**
 * @author lixf
 * 
 */
public class AbstractProcessor {
	protected Dictionary dictionary;

	public AbstractProcessor(Dictionary dictionary) {
		this.dictionary = dictionary;
	}

	public TermNatures createTermNatures(String natureName) {
		TermNatures natures = new BasicTermNatures();
		natures.addNature(Nature.valueOf(natureName));
		return natures;
	}

	public TermNatures createTermNatures(String natureName, int freq) {
		TermNatures natures = new BasicTermNatures();
		natures.addNature(Nature.valueOf(natureName), freq);
		return natures;
	}
	

	 /**
   * 判断字符串是否为空
   *
   * @param cs
   * @return
   */
  public boolean isBlank(CharSequence cs) {
      int strLen;
      if (cs == null || (strLen = cs.length()) == 0) {
          return true;
      }
      for (int i = 0; i < strLen; i++) {
          if (Character.isWhitespace(cs.charAt(i)) == false) {
              return false;
          }
      }
      return true;
  }		
}
